package com.wsmhz;

import com.wsmhz.exception.UserException;
import com.wsmhz.security.core.common.ServerResponse;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * create by tangbj on 2018/3/24
 */
@SpringBootApplication
@RestController
public class demo {
    public static void main(String[] args) {
        SpringApplication.run(demo.class,args);
    }

    @GetMapping("/hello")
    @ResponseBody
    public ServerResponse<String> hello(){
        return  ServerResponse.createBySuccessMessage("suucc");
    }

    @GetMapping("/runtimeException")
    @ResponseBody
    public ServerResponse<String> RuntimeException(){
        throw new RuntimeException("111");
    }

    @GetMapping("/userException")
    @ResponseBody
    public ServerResponse<String> UserException(){
        throw new UserException("111");
    }
}
